<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>更多操作</title>
		<style type="">
			li {
			    float: inherit;
			    text-indent: 0px;
			}
			.agentsForm{
				padding-left: 15px;
    			padding-top: 10px;
				overflow: hidden;
			}
			#agentsForm div textarea{
				width: 390px;
				height: 100px;
				margin-bottom: 30px;
			}
			#agentsFormGoupList, #agentsFormAgentList{
				width: 400px !important;
				display: block;
			}
			.select2-dropdown {
			    margin-left: 8px;
			    margin-top: -18px;
			}
		</style>
		
		<link rel="stylesheet" href="../plugins/select2/select2.min.css" type="text/css" title="styles1" />
		<link rel="stylesheet" href="../themes/online/big.css" title="styles1" />
		
		<script type="text/javascript" src="../plugins/jquery-x.x.js"></script>    
		<script type="text/javascript" src="../plugins/select2/select2.js"></script>
		<script type="text/javascript" src="../plugins/layer/layer.js"></script>
   		<script type="text/javascript" src="../js/mycommon.jquery.js"></script>
		
		<script type="text/javascript">
		
			var type = getQueryString("type");
			if("gchat" == type) {
				$("#existAgentsButton").show();
			}
			
			$(document).ready(function () {
				$("#agentsFormGoupList").select2({
					language: "zh-CN",
					ajax: {
					    url: '../user/TGroupDpAct.do?method=list',
					    delay: 350,
					    dataType: 'json',
					    data: function (term, type) {
							return {
								term: term.term,
								from: "select2-2"
							};
					    },
					    processResults: function (data) {
					      return {
					        results: data
					      };
					    }
					  }
				});
				$("#agentsFormAgentList").select2({
					language: "zh-CN",
					ajax: {
					    url: '../user/TUserDpAct.do?method=list',
					    delay: 350,
					    dataType: 'json',
					    data: function (term, type) {
							return {
								term: term.term,
								from: "select2",
								group : $("#agentsFormGoupList").val(),
								onlyOnline : $("#onlyOnline").attr("checked"),
							};
					    },
					    processResults: function (data) {
					      return {
					        results: data
					      };
					    }
					  }
				});
			});
			function inviteAgent(){
				var v = $("#agentsFormAgentList").val();
				if(!v) {
					parent.showLayer("请选择一个受理坐席");
				} else {
					if("gchat" == type) {
						parent.inviteAgent(v, $("#agentsFormRemark").val());
					} else if("transfer" == type) {
						parent.transfer2Agent(v, $("#agentsFormRemark").val());
					}
				}
			}
			var sid = getQueryString("sid");
			function seeAgents(){
				if($("#existAgents").is(":visible") == false) {				
					$.ajax({
						type:"POST", 
						dataType:"json", 
						async:true, 
						url:"../agent/AgentDpAct.do?method=processor&event=existAgents", 
						data:{sid:sid}, 
						success:function (resp) {
							for(var v = 0; v<resp.length;v++) {
								var one = "";
								one = "<div>" + resp[v].nickName + "[" + resp[v].name + "]</div>";
								$("#existAgents").append(one);
							}
						}, error:function (data) {
						}
					});		
				}
				$("#existAgents").toggle();
			}
		</script>
	</head>
	<body>
		<!--小转接窗口-->
		<div id="agentsForm" class="agentsForm">
			<div style="display: inline-block;">
				<font color="red"> * </font>受理技能组：
				<select id="agentsFormGoupList">
					<option></option>
				</select>
			</div>
			<div style="display: inline-block;">
				<p></p>
				<font color="red"> * </font>受理坐席<input type="checkbox" id="onlyOnline"/>仅在线：
				<select id="agentsFormAgentList">
					<option></option>
				</select>
			</div>
			<div>
				<p></p>
				备注:
				<div>
					<textarea style="" id="agentsFormRemark"></textarea>
				</div>
			</div>
			<div class="div-center">
				<button id="existAgentsButton" class="a_talking_button light-btn" onclick="seeAgents()" style="display:none">
					已有坐席
				</button>
				<button class="a_talking_button" onclick="parent.layer.closeAll();">
					关&nbsp;闭
				</button>
				<button class="a_talking_button light-btn" onclick="inviteAgent()">
					确&nbsp;定
				</button>
			</div>
		</div>
		<div id="existAgents" style="display: none" class="agentsForm">
		</div>
	</body>
</html>